import Vue from 'vue'
import Vuex from 'vuex'

import permission from './module/permission'
import tag from './module/tag'
import user from './module/user'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isCollapse: false,
    isToggle: false,
    theme: 'light',
  },
  getters: {
  },
  mutations: {
    toggleSidebar(state, isCollapse) {
      state.isCollapse = isCollapse
    },
    updateToggle(state, value) {
      state.isToggle = value
    },
    changeTheme(state) {
      console.log(state.theme)
      if (state.theme === 'light') {
        state.theme = 'dark'
      } else if (state.theme === 'dark') {
        state.theme = 'light'
      }
    },
  },
  actions: {
  },
  modules: {
    permission,
    tag,
    user
  }
})
